﻿<!-- *******************************************************************************\
| Copyright (c) 2011, Bashar Al-Rawi                                                |
| All rights reserved.                                                              |
|                                                                                   |
| Redistribution and use in source and binary forms, with or without                |
| modification, are permitted provided that the following conditions are met:       |
|    * Redistributions of source code must retain the above copyright               |
|      notice, this list of conditions and the following disclaimer.                |
|    * Redistributions in binary form must reproduce the above copyright            |
|      notice, this list of conditions and the following disclaimer in the          |
|      documentation and/or other materials provided with the distribution.         |
|    * Neither the name of the <organization> nor the                               |
|      names of its contributors may be used to endorse or promote products         |
|      derived from this software without specific prior written permission.        |
|                                                                                   |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   |
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     |
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            |
| DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY                |
| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES        |
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      |
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND       |
| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT        |
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     |
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      |
\*********************************************************************************-->
<phone:PhoneApplicationPage 
    x:Name="SearchPage"
    x:Class="Arabic.Search.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:my1="clr-namespace:Arabic.Controls;assembly=Arabic.Controls" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneBackgroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    OrientationChanged="PhoneApplicationPage_OrientationChanged"
    Loaded="PhoneApplicationPage_Loaded"
    MouseLeftButtonDown="PhoneApplicationPage_MouseLeftButtonDown"
    BackKeyPress="PhoneApplicationPage_BackKeyPress" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
    shell:SystemTray.IsVisible="False" IsTabStop="False" 
    >
    
    <Grid Name="grid1" ShowGridLines="False">
        <Grid.Resources>
            <my1:ApplicationGlobals x:Key="AppGlobals"/>
            <my1:SubtractFormatter x:Key="SubtractFormatter"/>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="740" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" VerticalAlignment="Top" Orientation="Vertical" HorizontalAlignment="Right" >
            <StackPanel.Resources>
                <Storyboard x:Name="ScrollTextStoryboard">
                    <DoubleAnimationUsingKeyFrames x:Name="ScrollTextAnimation"
                    Storyboard.TargetName="PaddingRectangle"
                    Storyboard.TargetProperty="Height"
                    Duration="0:0:0.7" AutoReverse="False">
                        <SplineDoubleKeyFrame x:Name="SlideKeyFrameBegin" KeySpline="1,0,0,0.98" KeyTime="0:0:0.4"/>
                        <SplineDoubleKeyFrame x:Name="SlideKeyFrame" KeySpline="1,0,0,0.98" KeyTime="0:0:0.7"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </StackPanel.Resources>

            <!-- This is the bubble-textbox -->
            <my1:RTLTextBox x:Name="textBlock" AcceptsReturn="False" Margin="12,12,12,0" Foreground="{StaticResource PhoneAccentBrush}" Padding="20,20,20,0" MaxWidth="800" Width="460"/>
            <Rectangle x:Name="PaddingRectangle" Height="0" Width="1"/>
        </StackPanel>
        <Canvas Grid.Row="1">
            <my1:Keyboard HorizontalAlignment="Stretch" Margin="0,0,0,0" x:Name="keyboard" VerticalAlignment="Stretch" Canvas.Left="0" RenderTransformOrigin="0.5,0.5" >
            </my1:Keyboard>
        </Canvas>
        <Grid.Background>
            <ImageBrush x:Name="bgImage" ImageSource="/Arabic.Search;component/Images/defaultHomeImage.jpg" />
        </Grid.Background>
    </Grid>

    <!-- Sample code showing usage of ApplicationBar -->

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" Opacity="1" IsMenuEnabled="False">
            <shell:ApplicationBarIconButton Click="sendButton_Click" x:Name="sendButton" IconUri="/Images/search.png" Text="ابحث"></shell:ApplicationBarIconButton>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>


</phone:PhoneApplicationPage>
